import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShopCashierQrcodeVO, ShopCashierQrcodeForm, ShopCashierQrcodeQuery } from '@/api/retail/shopCashierQrcode/types';


export const addShopCashierQrcode  = (data: ShopCashierQrcodeForm) => {
  return request({
    url: '/shop/cashierQrcode',
    method: 'post',
    data: data
  });
}

/**
 * 查询商店收银员二维码列表
 * @param query
 * @returns {*}
 */

export const listShopCashierQrcode = (query?: ShopCashierQrcodeQuery): AxiosPromise<ShopCashierQrcodeVO[]> => {
  return request({
    url: '/shop/cashierQrcode/list',
    method: 'get',
    params: query
  });
};

/**
 * 修改状态
 * @param id
 * @param status
 */
export const changeCashierQrcodeStatus = (id: number, status: string | number) => {
  const data = {
    id,
    status
  };
  return request({
    url: '/shop/cashierQrcode/changeStatus',
    method: 'post',
    data: data
  });
};

export const enableAll = () => {
  return request({
    url: '/shop/cashierQrcode/enableAll',
    method: 'get'
  });
}

export const disableAll = () => {
  return request({
    url: '/shop/cashierQrcode/disableAll',
    method: 'get'
  });
}
